
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 12/17/2012 22:53:59
-- Generated from EDMX file: F:\losezhang\MvcMasterPage\Role.Entity\Role.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [Role.Entity];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------


-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[Product]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Product];
GO
IF OBJECT_ID(N'[dbo].[WorkFlow]', 'U') IS NOT NULL
    DROP TABLE [dbo].[WorkFlow];
GO
IF OBJECT_ID(N'[dbo].[WorkFlow_Info]', 'U') IS NOT NULL
    DROP TABLE [dbo].[WorkFlow_Info];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'Product'
CREATE TABLE [dbo].[Product] (
    [ID] int  NOT NULL,
    [Name] varchar(50)  NOT NULL,
    [WorkFlowID] int  NOT NULL,
    [Info] varchar(512)  NULL
);
GO

-- Creating table 'WorkFlow'
CREATE TABLE [dbo].[WorkFlow] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [Name] varchar(50)  NULL,
    [Info] varchar(512)  NULL
);
GO

-- Creating table 'WorkFlow_Info'
CREATE TABLE [dbo].[WorkFlow_Info] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [PrevNode] int  NULL,
    [NextNode] int  NULL,
    [Name] varchar(50)  NOT NULL,
    [Info] varchar(512)  NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [ID] in table 'Product'
ALTER TABLE [dbo].[Product]
ADD CONSTRAINT [PK_Product]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'WorkFlow'
ALTER TABLE [dbo].[WorkFlow]
ADD CONSTRAINT [PK_WorkFlow]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'WorkFlow_Info'
ALTER TABLE [dbo].[WorkFlow_Info]
ADD CONSTRAINT [PK_WorkFlow_Info]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------